package com.wsz.matching.controller;

import com.wsz.matching.fegin.StartGameFeginClient;
import com.wsz.matching.service.MatchingServer;
import com.wsz.pojo.R;
import com.wsz.pojo.dto.MatchingDto;
import com.wsz.pojo.dto.MatchingIdDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MatchingController {

    @Autowired
    private MatchingServer matchingServer;

    @Autowired
    private StartGameFeginClient startGameFeginClient;

    @PostMapping("/player/add")
    public R addPlayer(@RequestBody MatchingDto matchingDto){
        return matchingServer.addPlayer(matchingDto);
    }

    @DeleteMapping("/player/remove")
    public R removePlayer(@RequestBody MatchingDto matchingDto){
        return matchingServer.removePlayer(matchingDto);
    }

    @GetMapping("/test")
    public R test(){
        MatchingIdDto matchingIdDto = new MatchingIdDto();
        matchingIdDto.setAId("13");
        matchingIdDto.setBId("14");
        return startGameFeginClient.startGame(matchingIdDto);
    }

}
